package com.easysoft.framework.action;

import com.easysoft.framework.beans.Page;
import com.easysoft.framework.casereply.model.SysCaseReplyQuery;
import com.easysoft.framework.casereply.model.SysCaseReplyView;
import com.easysoft.framework.casereply.model.SysCasemanagementQuery;
import com.easysoft.framework.casereply.model.SysCasemanagementView;
import com.easysoft.framework.casereply.service.SysCasemanagementService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

/**
 * Created by try on 2017/9/12.
 *
 * 报警接警处警基本信息
 */

@RestController
@RequestMapping(value = SystemCasemanagementAction.BASE_VIEW)
public class SystemCasemanagementAction {


    public static final String BASE_VIEW = "/caseReply";
    private static final Logger logger = LoggerFactory.getLogger(SystemCasemanagementAction.class);

    @Autowired
    @Qualifier("service.SysCasemanagementService")
    private SysCasemanagementService sysCasemanagementService;


    /**
     * 分页报警接警处警基本信息
     * @param page  分页信息
     * @param query 查询条件
     * @return 报警接警处警基本信息
     */
    @RequestMapping(value = "/listCasemanagement", method = {RequestMethod.POST, RequestMethod.GET})
    public ModelAndView listCasemanagement(Page page, SysCasemanagementQuery query) {
        logger.info("Call SystemCasemanagementAction.listCasemanagement({},{})", page.toString(), query.toString());
        List<SysCasemanagementView> list = sysCasemanagementService.selectSysCasemanagementListByPage(query,page);
        ModelAndView mv = new ModelAndView(BASE_VIEW + "/listCasemanagement");
        mv.addObject("page", page);
        mv.addObject("query", query);
        mv.addObject("listCasemanagement", list);
        return mv;
    }

}
